eeprom15 2.2.1
Loading...
Searching...
No Matches
eeprom15


EEPROM 15 Click

EEPROM 15 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Stefan Filipovic
  • Date : Mar 2025.
  • Type : I2C type

Software Support

Example Description

This example demonstrates the use of EEPROM 15 Click board by writing specified data to the memory and reading it back.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.EEPROM15

Example Key Functions

  • eeprom15_cfg_setup This function initializes Click configuration structure to initial values.
    void eeprom15_cfg_setup(eeprom15_cfg_t *cfg)
    EEPROM 15 configuration object setup function.
    EEPROM 15 Click configuration object.
    Definition eeprom15.h:179
  • eeprom15_init This function initializes all necessary pins and peripherals used for this Click board.
    err_t eeprom15_init(eeprom15_t *ctx, eeprom15_cfg_t *cfg)
    EEPROM 15 initialization function.
    EEPROM 15 Click context object.
    Definition eeprom15.h:162
  • eeprom15_select_bank This function selects the active memory bank in the EEPROM.
    err_t eeprom15_select_bank ( eeprom15_t *ctx, uint8_t bank_sel );
    err_t eeprom15_select_bank(eeprom15_t *ctx, uint8_t bank_sel)
    EEPROM 15 Select Memory Bank function.
  • eeprom15_write_memory This function writes data to the EEPROM memory starting from the specified address.
    err_t eeprom15_write_memory ( eeprom15_t *ctx, uint8_t address, uint8_t *data_in, uint8_t len );
    err_t eeprom15_write_memory(eeprom15_t *ctx, uint8_t address, uint8_t *data_in, uint8_t len)
    EEPROM 15 Write Memory function.
  • eeprom15_read_memory This function reads data from the EEPROM memory starting from the specified address.
    err_t eeprom15_read_memory ( eeprom15_t *ctx, uint8_t address, uint8_t *data_out, uint16_t len );
    err_t eeprom15_read_memory(eeprom15_t *ctx, uint8_t address, uint8_t *data_out, uint16_t len)
    EEPROM 15 Read Memory function.

Application Init

Initializes the driver and logger.

void application_init ( void )
{
log_cfg_t log_cfg;
eeprom15_cfg_t eeprom15_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
eeprom15_cfg_setup( &eeprom15_cfg );
if ( I2C_MASTER_ERROR == eeprom15_init( &eeprom15, &eeprom15_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
#define EEPROM15_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition eeprom15.h:149
void application_init(void)
Definition main.c:37
#define MIKROBUS_POSITION_EEPROM15
Definition main.c:27

Application Task

Writes a desired number of bytes to the memory and then verifies if it is written correctly by reading from the same memory location and displaying the memory content on the USB UART.

void application_task ( void )
{
static uint8_t bank_sel = EEPROM15_BANK_SEL_0;
uint8_t data_buf[ EEPROM15_MEM_PAGE_SIZE + 1 ] = { 0 };
// Selecting memory bank
if ( EEPROM15_ERROR == eeprom15_select_bank ( &eeprom15, bank_sel ) )
{
log_error( &logger, " No communication with EEPROM." );
for ( ; ; );
}
log_printf ( &logger, "\r\n Memory bank: %u\r\n", ( uint16_t ) bank_sel );
log_printf ( &logger, " Memory address: 0x%.2X\r\n", ( uint16_t ) STARTING_ADDRESS );
bank_sel ^= EEPROM15_BANK_SEL_1;
// Write/Read first iterration
{
}
else
{
memcpy ( data_buf, DEMO_TEXT_MESSAGE_1, strlen ( DEMO_TEXT_MESSAGE_1 ) );
}
{
log_printf ( &logger, " Write data: %s\r\n", data_buf );
}
Delay_ms ( 100 );
memset ( data_buf, 0, sizeof ( data_buf ) );
{
log_printf ( &logger, " Read data: %s\r\n", data_buf );
}
Delay_ms ( 100 );
// Write/Read second iterration
{
}
else
{
memcpy ( data_buf, DEMO_TEXT_MESSAGE_2, strlen ( DEMO_TEXT_MESSAGE_2 ) );
}
{
log_printf ( &logger, " Write data: %s\r\n", data_buf );
}
Delay_ms ( 100 );
memset ( data_buf, 0, sizeof ( data_buf ) );
{
log_printf ( &logger, " Read data: %s\r\n", data_buf );
}
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
@ EEPROM15_ERROR
Definition eeprom15.h:197
@ EEPROM15_OK
Definition eeprom15.h:196
#define EEPROM15_BANK_SEL_0
EEPROM 15 bank selection setting.
Definition eeprom15.h:107
#define EEPROM15_BANK_SEL_1
Definition eeprom15.h:108
#define EEPROM15_MEM_PAGE_SIZE
Definition eeprom15.h:100
void application_task(void)
Definition main.c:67
#define DEMO_TEXT_MESSAGE_2
Definition main.c:31
#define DEMO_TEXT_MESSAGE_1
Definition main.c:30
#define STARTING_ADDRESS
Definition main.c:32

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.